Skip to main content

Project Structure

Introduction

An typical Atem project often contains four project structure levels:

  • Source File: A source file is a single Atem source file which is contained in a module.

  • Module: A module is a single unit of functionality. Modules can be imported by other module with the import keyword.

  • Package: A package is a smallest unit for compilation and code distribution. A package will produce single executable or library.

  • Project: A project is a set of related package that presents some set of functionality.

Module

Declaring a Module

You can declare modules using the SomeModuleName: module = {}; syntax:

mainmodule: module = {
main: func = {
return 0;
};
};

Nested modules are also allowed:

example: module = {
foo: module = {

};
bar: module = {

};
};

You can omit the = {} to write a short form of module declaration if there is only one module in the source file. The short form must be written in the first line of the source file:

mainmodule: module;

main: func = {
return 0;
};

Access Control

Atem provides five levels of access control:

  • Open Access: Open access enables entities to be used within any code from their defined module, and also in a source file from another module that imports the defining module.
  • Public Access: Public access is almost the same as the open access. However, open access enables code from another module to inheritance and overriding, which can increase the unnecessary relations between modules. If your classes are only designed for inheritance and overriding from their own module, prefer public access to open access instead.
  • Internal Access: Internal access enables entities to be used from the same module. Any usage outside the module will be considered as a compile error.
  • File-private Access: File-private access restricts entities only to be used from their source file. Any usage outside the source file will be considered as a compile error.
  • Private Access: Private access restricts entities only to be used to the enclosing definition.

You can specify the access level of entities by placing access level specifiers before their definition:

open SomeOpenClass: class = {};
public SomePublicClass: class = {};
internal SomeInternalClass: class = {};
filePrivate SomeFilePrivateClass: class = {};
private SomePrivateClass: class = {};

Package and Project